-
-
Notifications
You must be signed in to change notification settings - Fork 582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent installation of the "tests" package #1555
Conversation
Tests should not be listed under packages, otherwise setup.py attempts to install a "tests" package, causing potential clashes with other packages.
This looks good to me! I'll have to do some testing later this afternoon to confirm, as poetry used to handle includes poorly - which led to the tests always being included across package types, see: #1266 looking at the linked poetry issues quickly it does look like poetry may have fixed this issue now and so this approach will work again. Thanks~ ~Timothy |
The method you used to include tests was probably the only one available at the time. l spent some time researching before submitting the PR. I found this issue and this PR that allows for finer-grained inclusion. The documentation was also updated to remove the example advising users to include tests as a package. |
Thanks so much for doing the research and fixing this long running issue! I was able to confirm locally that it is now working correctly and will merge this into master and do a release shortly that contains just this packaging fix. Thanks! ~Timothy |
This has been deployed with release 5.6.3. Thanks! ~Timothy |
Works great, thanks a lot :) |
https://build.opensuse.org/request/show/841728 by user bnavigator + dimstar_suse - Update to Version 5.6.4 * Fixed #1556: Empty line added between imports that should be skipped. - Version 5.6.3 * Improved packaging of test files alongside source distribution (see: PyCQA/isort#1555). - Version 5.6.2 * Fixed #1548: On rare occasions an unecessary empty line can be added when an import is marked as skipped. * Fixed #1542: Bug in VERTICAL_PREFIX_FROM_MODULE_IMPORT wrap mode. * Fixed #1552: Pylama test dependent on source layout. * Goal Zero: (Tickets related to aspirational goal of achieving 0 regressions for remaining 5.0.0 lifespan): * Zope added to integration test suite * Additional testing of CLI (simulate unseekable streams) - now only requires poetry.core as PEP517 backend - Fix building and install
5.9.3 July 28 2021 Improved text of skipped file message to mention gitignore feature. Made all exceptions pickleable. Fixed : Pylama integration ignores pylama specific isort config overrides. Fixed : --from-first CLI flag shouldn't take any arguments. Fixed : Sorting literals sometimes ignored when placed on first few lines of file. Fixed : extend_skip is not honored wit a git submodule when skip_gitignore=true. 5.9.2 July 8th 2021 Improved behavior of isort --check --atomic against Cython files. Fixed : Future imports added below assignments when no other imports present. Fixed : skip-gitignore will check files not in the git repository. Fixed : in some cases when skip-gitignore is set, isort fails to skip any files. Fixed : Encoding issues surfacing when invalid characters set in __init__.py files during placement. Fixed : Improved handling of skips against named streamed in content. 5.9.1 June 21st 2021 [hotfix] Fixed : projects with many files and skip_ignore set can lead to a command-line overload. 5.9.0 June 21st 2021 Improved CLI startup time. Implemented : Provisional support for PEP 582: skip __pypackages__ directories by default. Implemented : More intuitive handling of isort:skip_file comments on streams. Implemented : Support for using action comments to avoid adding imports to individual files. Implemented : Ability to customize output format lines. Implemented : Support for custom sort functions. Implemented : Improved behavior for running isort in atomic mode over Cython source files. Fixed (PyCQA/isort#1695): added imports being added to doc string in some cases. Fixed (PyCQA/isort#1714): in rare cases line continuation combined with tabs can output invalid code. Fixed (PyCQA/isort#1726): isort ignores reverse_sort when force_sort_within_sections is true. Fixed : comments in hanging indent modes can lead to invalid code. Fixed : repeat noqa comments dropped when * import and non * imports exist from the same package. Fixed : repeat noqa comments on separate from lines with force-single-line set, sometimes get dropped. Goal Zero (Tickets related to aspirational goal of achieving 0 regressions for remaining 5.0.0 lifespan): Implemented : 100% branch coverage (in addition to line coverage) enforced. Implemented : Strict typing enforcement (turned on mypy strict mode). 5.8.0 March 20th 2021 Fixed : as import comments can in some cases be duplicated. Fixed : extra newline added with float-to-top, after skip, in some cases. Fixed : incorrect placement of noqa comments with multiple from imports. Fixed : in some cases different length limits for dos based line endings. Implemented : Export MyPY type hints. Implemented : Identified import statements now return runnable code. Implemented : Added "wemake" profile. Implemented : Parallel (-j) now defaults to number of CPU cores if no value is provided. Implemented : Added a safeguard against accidental usage against /. Implemented / : Provide a flag --overwrite-in-place to ensure same file handle is used after sorting. Implemented : Added support for extending skips with --extend-skip and --extend-skip-glob. Implemented : Auto identification and skipping of some invalid import statements. Implemented : Ability to reverse the import sorting order. Implemented : Added ability to push star imports to the top to avoid overriding explicitly defined imports. Documented : Skip doesn't support plain directory names, but skip_glob does. 5.7.0 December 30th 2020 Fixed : In rare circumstances an extra comma is added after import and before comment. Fixed : isort encounters bug in Python 3.6.0. Implemented : Provide ways for extension formatting and file paths to be specified when using streaming input from CLI. Implemented : Ability to output and diff within a single API call to isort.file. Implemented , & : Better more useful fatal error messages. Implemented : Support for automatically fixing mixed indentation of import sections. Implemented : Added a CLI option for skipping symlinks. Implemented : Support for disabling float_to_top from the command line. Implemented : Allow toggling section comments on and off for indented import sections. 5.6.4 October 12, 2020 Fixed : Empty line added between imports that should be skipped. 5.6.3 October 11, 2020 Improved packaging of test files alongside source distribution (see: PyCQA/isort#1555). 5.6.2 October 10, 2020 Fixed : On rare occasions an unecessary empty line can be added when an import is marked as skipped. Fixed : Bug in VERTICAL_PREFIX_FROM_MODULE_IMPORT wrap mode. Fixed : Pylama test dependent on source layout. Goal Zero: (Tickets related to aspirational goal of achieving 0 regressions for remaining 5.0.0 lifespan): Zope added to integration test suite Additional testing of CLI (simulate unseekable streams) 5.6.1 [Hotfix] October 8, 2020 Fixed : Unstable (non-idempotent) behavior with certain src trees. 5.6.0 October 7, 2020 Implemented : Provide helpful feedback in case a custom config file is specified without a configuration. Implemented : Default to sorting imports within .pxd files. Implemented : Improved float-to-top behavior when there is an existing import section present at top-of-file. Implemented : Support for easily seeing all files isort will be ran against using isort . --show-files. Implemented : Improved handling of encoding errors. Improved handling of unsupported configuration option errors (see ). Fixed : Better interactive documentation for future option. Fixed : Quiet config option not respected by file API in some circumstances. Fixed : pylama integration is not working correctly out-of-the-box. Fixed : --check does not work with stdin source. Fixed : isort gets confused by single line, multi-line style comments when using float-to-top. Fixed : Some warnings can't be disabled with --quiet. Fixed : in rare cases isort can ignore direct from import if as import is also on same line. Potentially breaking changes: Implemented : Officially support Python 3.9 stdlib imports by default. Fixed : Incorrect third vs first party categorization - namespace packages. Fixed : "Google" profile is not quite Google style. Fixed "PyCharm" profile to always add 2 lines to be consistent with what PyCharm "Optimize Imports" does. Goal Zero: (Tickets related to aspirational goal of achieving 0 regressions for remaining 5.0.0 lifespan): Implemented : Full testing of stdin CLI Options Added additional branch coverage. More projects added to integration test suite. 5.5.5 [Hotfix] October 7, 2020 Fixed : in extremely rare cases isort 5.5.4 introduces syntax error by removing closing paren. 5.5.4 [Hotfix] September 29, 2020 Fixed : in rare cases isort changes the content of multiline strings after a yield statement. Fixed : Support case where known_SECTION points to a section not listed in sections. 5.5.3 [Hotfix] September 20, 2020 Fixed : in rare cases isort can mangle yield from or raise from statements. 5.5.2 [Hotfix] September 9, 2020 Fixed : --diff option is ignored when input is from stdin. 5.5.1 September 4, 2020 Fixed : Ensure indented import sections with import heading and a preceding comment don't cause import sorting loops. Fixed : isort error when float to top on almost empty file. Fixed and : noqa comment moved to where flake8 cant see it. Fixed : .svn missing from default ignore list. 5.5.0 September 3, 2020 Fixed : isort: off comment doesn't work, if it's the top comment in the file. Fixed : reverse_relative setting doesn't have any effect when combined with force_sort_within_sections. Fixed : --skip can error in the case of projects that contain recursive symlinks. Fixed : ensure_newline_before_comments doesn't work if comment is at top of section and sections don't have lines between them. Fixed : comments in imports with ";" can keep isort from recognizing import line. Fixed : As imports removed when combine_star is set. Fixed : --float-to-top has no effect if no import is already at the top. Fixed : isort never settles on module docstring + add import. Fixed : Error raised when repo contains circular symlinks. Fixed : noqa comment is moved from star import to constant import. Fixed & 1445: Incorrect placement of import additions. Fixed : isort5 throws error when stdin used on Windows with deprecated args. Implemented : Added support for specifying config file when using git hook (thanks @diseraluca!). Implemented : Added support for coloring diff output. Implemented : New multi-line grid mode without parentheses. Goal Zero (Tickets related to aspirational goal of achieving 0 regressions for remaining 5.0.0 lifespan): Implemented : Extensive profile testing. Implemented : Proprety based testing applied to code snippets. Implemented : Create automated integration test that includes full code base of largest OpenSource isort users. Potentially breaking changes: Fixed : --check doesn't print to stderr as the documentation says. This means if you were looking for ERROR: messages for files that contain incorrect imports within stdout you will now need to look in stderr. 5.4.2 Aug 14, 2020 Fixed : Known other does not work anymore with .editorconfig. Fixed: Regression in first known party path expansion. 5.4.1 [Hotfix] Aug 13, 2020 Fixed : --combine-as loses noqa in different circumstances. 5.4.0 Aug 12, 2020 Implemented : support for length sort only of direct (AKA straight) imports. Fixed : --combine-as loses noqa. Fixed : --dont-order-by-type CLI broken. 5.3.2 [Hotfix] Aug 7, 2020 Fixed incorrect warning code (W503->W0503). 5.3.1 Aug 7, 2020 Improve upgrade warnings to be less noisy and point to error codes for easy interoperability with Visual Studio Code (see: ). 5.3.0 Aug 4, 2020 Implemented ability to treat all or select comments as code (issue ) Implemented ability to use different configs for different file extensions (issue ) Implemented ability to specify the types of imports (issue ) Implemented ability to dedup import headings (issue ) Added experimental support for sorting literals (issue ) Added experimental support for sorting and deduping groupings of assignments. Improved handling of deprecated single line variables for usage with Visual Studio Code (issue ) Improved handling of mixed newline forms within same source file. Improved error handling for known sections. Improved API consistency, returning a boolean value for all modification API calls to indicate if changes were made. Fixed : spurious errors when combining skip with --gitignore. Fixed : --skip-gitignore does not honor ignored symlink Internal Development: Initial hypothesmith powered test to help catch unexpected syntax parsing and output errors (thanks @Zac-HD!) 5.2.2 July 30, 2020 Fixed : return status when arguments are passed in without files or a content stream. 5.2.1 July 28, 2020 Update precommit to default to filtering files that are defined in skip. Improved relative path detection for skip config usage. Added recursive symbolic link protection. Implemented : Support for color output using --color. Implemented recursive symlink detection support. 5.2.0 July 27, 2020 Implemented : Official API for diff capturing. Implemented : Warn when sections don't match up. Implemented : By popular demand, filter_files can now be set in the config option. Implemented : Support for respecting git ignore via "--gitignore" or "skip_gitignore=True". Implemented : Ability to only add imports if existing imports exist. Implemented : Support for custom sharable isort profiles. Implemented : Added support for git_hook lazy option (Thanks @sztamas!) Implemented : Added an additional multi_line_output mode for more compact formatting (Thanks @sztamas!) Implemented : Option for LOCALFOLDER. Implemented : Added support for output formatting plugins. isort: split can now be used at the end of an import line. Fixed : Extra indent is not preserved when isort:skip is used in nested imports. Fixed : --diff works incorrectly with files that have CRLF line endings. Improved code repositories usage of pylint tags (). 5.1.4 July 19, 2020 Fixed issue : Use of wrap_length raises an exception about it not being lower or equal to line_length. Fixed issue : Ensure stdout can be stubbed dynamically for show_unified_diff function. 5.1.3 July 18, 2020 Fixed issue : Fix comments duplicated when --fass option is set. 5.1.2 July 17, 2020 Fixed issue / : Comments not wrapped for long lines Fixed issue : Bug related to isort:skip usage followed by a multiline comment block 5.1.1 July 15, 2020 Fixed issue : Occasionally two extra newlines before comment with -n & --fss. Fixed issue : --diff broken when reading from standard input. 5.1.0 July 14, 2020 isort now throws an exception if an invalid settings path is given (issue ). Implemented support for automatic redundant alias removal (issue ). Implemented experimental support for floating all imports to the top of a file (issue ) Fixed : support for semicolons in decorators. Fixed : Extra newline before comment with -n + --fss. Fixed : -k or --keep-direct-and-as-imports option has been deprecated as it is now always on. Formatting changes implied: Fixed : rewrite of as imports changes the behavior of the imports. 5.0.9 July 11, 2020 Fixed : Import headings in nested sections leads to check errors 5.0.8 July 11, 2020 Fixed & : New line detection issues on Windows. Fixed : Fix bundled git hook. 5.0.7 July 9, 2020 Fixed : unexpected --diff behavior. Fixed : Fixed NOQA comment regression. 5.0.6 July 8, 2020 Fixed : comments and --trailing-comma can generate invalid code. Fixed : extra new line in indented imports, when immediately followed by a comment. Fixed : isort 5 no longer recognises sre_parse as a stdlib module. Fixed : add_imports moves comments following import section. Fixed : Fix a bug that creates only one line after triple quotes. 5.0.5 July 7, 2020 Fixed : packaging issue with bundling tests via poetry. Fixed : Regression when sorting .pyi files from CLI using black profile. Fixed & : Blank line after docstring removed. Fixed : CLI Help out of date with isort 5. Fixed : Unecessary blank lines above nested imports when import comments turned on. Fixed : Usage of --add-imports alongside --check is broken. Fixed : Stream usage no longer auto picking up config file from current working directory. Fixed : Force_single_line setting removes immediately following comment line. Fixed : ensure_newline_before_comments doesnt work with force_sort_within_sections. Setting not_skip will no longer immediately fail but instead give user a warning and direct to upgrade docs. 5.0.4 July 6, 2020 Fixed : a regression with comment handling and force_sort_within_sections config option Added warning for deprecated CLI flags and linked to upgrade guide. 5.0.3 - July 4, 2020 Fixed setup.py command incorrectly passing check=True as a configuration parameter (see: PyCQA/isort#1258) Fixed missing patch version Fixed issue : Atomic fails when passed in not readable output stream 5.0.2 - July 4, 2020 Ensured black profile was complete, adding missing line_length definition. 5.0.1 - July 4, 2020 Fixed a runtime error in a vendored dependency (toml). 5.0.0 Penny - July 4, 2020 Breaking changes: isort now requires Python 3.6+ to run but continues to support formatting on ALL versions of python including Python 2 code. isort deprecates official support for Python 3.4, removing modules only in this release from known_standard_library: user Config files are no longer composed on-top of each-other. Instead the first config file found is used. Since there is no longer composition negative form settings (such as --dont-skip or it's config file variant not_skip) are no longer required and have been removed. Two-letter shortened setting names (like ac for atomic) now require two dashes to avoid ambiguity: --ac. For consistency with other tools -v now is shorthand for verbose and -V is shorthand for version. See Issue: . length_sort_{section_name} config usage has been deprecated. Instead length_sort_sections list can be used to specify a list of sections that need to be length sorted. safety_excludes and unsafe have been deprecated Config now includes as default full set of safety directories defined by safety excludes. --recursive option has been removed. Directories passed in are now automatically sorted recursive. --apply option has been removed as it is the default behaviour. isort now does nothing, beyond giving instructions and exiting status code 0, when ran with no arguments. a new --interactive flag has been added to enable the old style behaviour. isort now works on contiguous sections of imports, instead of one whole file at a time. isort now formats all nested "as" imports in the "from" form. import x.y as a becomes from x import y as a. NOTE: This was undone in version 5.1.0 due to feedback it caused issues with some project conventions. keep_direct_and_as_imports option now defaults to True. appdirs is no longer supported. Unless manually specified, config should be project config only. toml is now installed as a vendorized module, meaning pyproject.toml based config is always supported. Completely new Python API, old version is removed and no longer accessible. New module placement logic and module fully replaces old finders. Old approach is still available via --old-finders. Internal: isort now utilizes mypy and typing to filter out typing related issues before deployment. isort now utilizes black internally to ensure more consistent formatting. profile support for common project types (black, django, google, etc) Much much more. There is some difficulty in fully capturing the extent of changes in this release - just because of how all encompassing the release is. See: Github Issues for more.
Hi,
Tests should not be listed under packages, otherwise setup.py attempts to install a "tests" package, causing potential clashes with other packages.
Comparison of the generated setup.py files before and after the change: